package com.bourne.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bourne.model.BaseCoreDO;

import java.util.List;

/**
 * @program core-service
 * @description
 * @author: bourne
 * @create 2021-36-01 12:36:58
 **/
public interface BaseCoreService<M extends BaseMapper<T>, T extends BaseCoreDO> extends IService<T> {

    QueryWrapper<T> getQueryWrapper(T bean, Class<T> classes, boolean superFields);

    /**
     * 执行之前
     * @param t
     * @return
     */
    Object preExecute(T t);

    /**
     * 执行之后
     * @param t
     * @return
     */
    Object postExecute(T t);

    /**
     * 通用插入，插入一个实体对象到数据库，所以字段将参与操作，除非你使用ColumnIgnore注解
     * @param entity
     */
    int insert(T entity);


    /**
     * 1 - 2的差集
     * @param firstArrayList
     * @param secondArrayList
     * @param fieldName
     * @return
     */
    List<T> diffList(List<T>firstArrayList, List<T>secondArrayList, String fieldName);

    /**
     * 交集
     * @param firstArrayList
     * @param secondArrayList
     * @param fieldName
     * @return
     */
    List<T> intersection(List<T>firstArrayList, List<T>secondArrayList, String fieldName);


}
